1 00:00:01,080 --> 00:00:01,920 Welcome. 2 00:00:01,920 --> 00:00:07,500 In this lecture, I want to show you a neat instance called Trails, and this is where you can add dynamic 3 00:00:07,500 --> 00:00:09,990 and visually appealing effects into your games. 4 00:00:10,350 --> 00:00:14,620 Now, a trail is an instance that requires attachments in order to work. 5 00:00:14,640 --> 00:00:19,500 Specifically, you need to attachments that define the starting and ending point for the trail. 6 00:00:20,500 --> 00:00:25,390 And for the trail to be emanated, it needs a bass part parent for it to work. 7 00:00:25,510 --> 00:00:31,600 So we're going to create some attachments in here, and these attachments are going to represent the 8 00:00:31,600 --> 00:00:33,820 starting and ending point for my trail. 9 00:00:33,940 --> 00:00:39,460 So specifically for this part, I'm going to move this attachment to be at the very end here and move 10 00:00:39,460 --> 00:00:40,500 it towards the back. 11 00:00:40,510 --> 00:00:45,400 And then I can duplicate this attachment and do it at the other end here as well. 12 00:00:46,180 --> 00:00:51,490 So what you can imagine is that there is a line between this attachment and this attachment going across 13 00:00:51,490 --> 00:00:52,150 the brick. 14 00:00:52,150 --> 00:00:54,290 And what I put a trail on this brick. 15 00:00:54,310 --> 00:00:57,520 It's going to create a line from this point to this point. 16 00:00:57,520 --> 00:01:03,190 And when I move the brick, it'll have this flat surface or this flat trail coming out of my part. 17 00:01:04,350 --> 00:01:06,810 So we can add a trail into my part. 18 00:01:07,480 --> 00:01:10,030 And then I can specify the attachments for the trail. 19 00:01:10,030 --> 00:01:12,280 So we'll do that one and that one. 20 00:01:13,410 --> 00:01:17,940 Now what you'll see is that when I move my part, you'll see a trail come out the end. 21 00:01:18,330 --> 00:01:19,200 Just like that. 22 00:01:19,780 --> 00:01:22,900 So this is the trail that is emanating from my part. 23 00:01:24,680 --> 00:01:28,580 Now trails have a bunch of properties in here that we can mess around with and we'll go with the first 24 00:01:28,580 --> 00:01:29,630 one, which is color. 25 00:01:29,630 --> 00:01:30,830 Pretty self explanatory. 26 00:01:30,830 --> 00:01:37,730 We can pick any kind of color we'd like for our trail and we can also change the color over time based 27 00:01:37,730 --> 00:01:39,860 on the lifetime of our trail. 28 00:01:39,860 --> 00:01:41,000 But I'm going to leave it. 29 00:01:41,000 --> 00:01:42,710 I guess that green is fine. 30 00:01:43,650 --> 00:01:44,550 Inside this trail. 31 00:01:44,550 --> 00:01:47,580 We can change if we want the trail to face the camera. 32 00:01:47,640 --> 00:01:52,230 So that means no matter what direction I'm looking at, this part, the trail is always going to be 33 00:01:52,230 --> 00:01:54,660 oriented towards my camera, just like that. 34 00:01:54,900 --> 00:01:56,920 So I'll showcase it again. 35 00:01:56,940 --> 00:02:02,670 Let me just put some trails in here and you can see that the trail is following with an orientation 36 00:02:02,670 --> 00:02:03,660 towards my camera. 37 00:02:06,450 --> 00:02:11,250 The next property is light emission and light influence, and these are basically the same for the other 38 00:02:11,250 --> 00:02:13,830 light emission and light influence properties that we've seen. 39 00:02:14,770 --> 00:02:21,490 So if I go and set light influence to zero, that means any lighting in my game is not going to have 40 00:02:21,490 --> 00:02:23,890 an effect on my trail. 41 00:02:23,890 --> 00:02:30,520 And if I set the light emission to something like one, I'm kind of emitting the blending of colors 42 00:02:30,520 --> 00:02:32,500 with this particular color here. 43 00:02:34,720 --> 00:02:36,550 But we'll just leave it at the default. 44 00:02:37,090 --> 00:02:42,970 We can also apply textures to our trails, so let's demonstrate that we'll go to the home tab and open 45 00:02:42,970 --> 00:02:46,140 up the toolbox and we can just pick a random image in here. 46 00:02:46,180 --> 00:02:48,280 We'll just do giga Chad, because why not? 47 00:02:49,030 --> 00:02:51,690 And then we can paste that texture ID in there. 48 00:02:51,700 --> 00:02:53,170 We don't need this anymore. 49 00:02:53,440 --> 00:02:55,270 And now if I move my trail. 50 00:02:55,660 --> 00:02:56,260 There we go. 51 00:02:56,260 --> 00:02:57,790 We have green giga Chad. 52 00:02:58,740 --> 00:03:04,860 And this texture will continue to stretch for however long the duration is and how far my part moves. 53 00:03:06,440 --> 00:03:09,560 But if you don't want the trail to stretch, that's where these other properties come in. 54 00:03:09,680 --> 00:03:15,470 So in here we can define a texture length in studs, basically the maximum amount of vertical height 55 00:03:15,470 --> 00:03:21,120 for our image, and that's only applied if we pick static or wrap for our texture mode. 56 00:03:21,140 --> 00:03:26,900 Obviously, stretch means that the texture gets stretched and it will ignore this texture like property. 57 00:03:26,900 --> 00:03:32,570 But if I set to something like static and then move my part, you will see that the texture will repeat 58 00:03:32,570 --> 00:03:33,350 itself. 59 00:03:33,350 --> 00:03:38,540 And each texture, its height, is one stud from this point to that point. 60 00:03:39,720 --> 00:03:42,450 Now, what's the difference between static and rap? 61 00:03:42,480 --> 00:03:48,120 Well, static means is that when the texture is drawn, you can see they're static and they don't move 62 00:03:48,120 --> 00:03:48,990 with the part. 63 00:03:49,260 --> 00:03:55,890 But if I change it to rap when it creates new textures, you can see that these textures are following 64 00:03:55,890 --> 00:03:56,720 my part. 65 00:03:56,730 --> 00:03:59,430 They're going along and following the trail. 66 00:03:59,460 --> 00:04:01,500 That's just the difference between those two. 67 00:04:02,210 --> 00:04:06,080 And if I go in here and I change the texture length to be something like four studs, you can see that 68 00:04:06,080 --> 00:04:07,100 change as well. 69 00:04:07,310 --> 00:04:10,100 So now my image is four studs in height. 70 00:04:11,550 --> 00:04:16,770 We also have transparency for our trail as well, so we can make it to be completely opaque so you can't 71 00:04:16,770 --> 00:04:17,910 see through it at all. 72 00:04:17,970 --> 00:04:21,000 And of course, you can also adjust this over time. 73 00:04:24,410 --> 00:04:29,120 And then some other settings we have in here is like enabled whether or not the trail is showing up 74 00:04:29,120 --> 00:04:30,230 pretty easy. 75 00:04:30,760 --> 00:04:31,880 Lifetime. 76 00:04:31,880 --> 00:04:34,720 This is how long the trail will last before it decays. 77 00:04:34,730 --> 00:04:41,480 And of course you can set kind of how long you want this to be upwards of 20 seconds, or you can make 78 00:04:41,480 --> 00:04:42,440 it really short. 79 00:04:43,420 --> 00:04:47,620 You can barely see the trail at all because it's decaying and 0.0 1 seconds. 80 00:04:48,380 --> 00:04:53,630 We can also define the maximum length and the minimum length that our trail has to be. 81 00:04:54,110 --> 00:04:56,980 So let's say my lifetime was 10 seconds. 82 00:04:56,990 --> 00:05:01,080 I could set a maximum length for this trail, such as ten studs. 83 00:05:01,100 --> 00:05:06,460 That way, if my part travels greater than ten studs, the trail won't be larger than ten studs. 84 00:05:06,470 --> 00:05:11,180 You'll see, my trail is getting limited to a length of ten studs. 85 00:05:11,510 --> 00:05:13,730 But if I increase it to something like 50. 86 00:05:15,660 --> 00:05:17,430 Then it should. 87 00:05:18,500 --> 00:05:19,490 Come longer. 88 00:05:19,610 --> 00:05:21,290 That I changed the wrong property. 89 00:05:21,720 --> 00:05:22,580 Oh, it didn't change it. 90 00:05:23,060 --> 00:05:23,600 50. 91 00:05:23,720 --> 00:05:24,440 There we go. 92 00:05:26,390 --> 00:05:28,850 Now you can see that my trail is much longer. 93 00:05:30,050 --> 00:05:32,600 And we'll set the lifetime back to be something like one second. 94 00:05:33,330 --> 00:05:35,760 And then we also have something called width scale. 95 00:05:35,760 --> 00:05:42,540 And this is the scale of our image or our trail from the starting point to the ending point, the two 96 00:05:42,540 --> 00:05:43,460 attachments. 97 00:05:43,470 --> 00:05:49,320 So if I change this to 0.5, then it's going to be half the size of our regular trail, as you can see 98 00:05:49,320 --> 00:05:49,980 right there. 99 00:05:50,950 --> 00:05:54,130 And of course, you can also adjust this to be different over time. 100 00:05:54,930 --> 00:06:01,320 So maybe at the beginning my trail can be huge and then it can decay close to nothing over time. 101 00:06:01,800 --> 00:06:06,150 So if I go and move my part, you can see that my trail shrinks over time. 102 00:06:08,290 --> 00:06:08,920 Pretty neat. 103 00:06:09,550 --> 00:06:14,200 Other than that, the trail instance and the Roadblocks API is a very powerful tool for creating visually 104 00:06:14,200 --> 00:06:16,420 interesting and dynamic effects in your game. 105 00:06:16,780 --> 00:06:21,130 By using the various properties and methods available, you can customize the appearance and behavior 106 00:06:21,130 --> 00:06:25,990 of the trail to achieve a wide range of effects to enhance the overall experience for your game.